package com.ifly.task.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.ifly.task.anno.ExcelSelected;
import com.ifly.task.converter.GenderConverter;
import com.ifly.task.converter.TypeConverter;
import com.ifly.task.selector.impl.TypeSelector;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;


@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@HeadRowHeight(value = 25) // 头部行高
@ContentRowHeight(value = 15) // 内容行高
@ColumnWidth(value = 20) // 列宽
@HeadStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER) // 表头样式
@HeadFontStyle(fontName = "黑体")
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER) // 内容样式
public class UserExcelVo {

    // 默认不展示的字段
    @ColumnWidth(value = 0)
    @ExcelProperty(value = {"用户列表", "编号"})
    private Long id;

    @ExcelProperty(value = {"用户列表", "姓名"})
    private String userName;

    //静态下拉框
    @ExcelSelected(source = {"男","女","保密"})
    @ExcelProperty(value = {"用户列表", "性别"}, converter = GenderConverter.class)
    private Integer gender;

    //动态下拉框
    @ExcelSelected(sourceClass = TypeSelector.class)
    @ExcelProperty(value = {"用户列表", "类型"}, converter = TypeConverter.class)
    private Integer type;

}
